/**
 * 
 */
package com.gragra.cooccClustering;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import com.gragra.parseOptions.CommandLineException;
import com.gragra.parseOptions.Parser;
/**
 * @author Christoph Teichmann
 * 25.05.2013
 */
public class MakeCRPTagging
{
	/**
	 * @param args
	 * @throws IOException 
	 * @throws InterruptedException 
	 */
	public static void main(String[] args) throws IOException, InterruptedException
	{
		Parser pa = new Parser();
		CRPClustering cwk = new CRPClustering();
		cwk.addOptions(pa);
		pa.setIgnoreUnknown(false);
		pa.setMaxArgs(2);
		pa.setMinArgs(2);
		pa.setArgumentDescription(0, "This is the name of the input file used");
		pa.setArgumentDescription(1, "This is the name of the output file used, the file will be overwritten, if it alre" +
				"ady exists");
		pa.setProgramDescription("This programm is used to" +
				" annotate a corpus with context tags generated by a CRP clustering of the words" +
				" based on co-occurrences and orthographic features");
		try
		{
			pa.parse(args);
		}
		catch(CommandLineException e)
		{
			System.out.println(pa.writeOutHelp());
			System.exit(0);
		}
		if(pa.hadHelp())
		{
			System.out.println(pa.writeOutHelp());
			System.exit(0);
		}
		BufferedReader br = new BufferedReader(pa.getFileReaderFromArgument(0));
		BufferedWriter bw = new BufferedWriter(pa.getFileWriterFromArgument(1));
		cwk.annotate(br, bw, pa);
		br.close();
		bw.close();
	}
}